/**
 * Created by Sin on 10/16/2016.
 */
// 定义模块
var scroll = angular.module('scroll', []);
// 定义滚动指令
scroll.directive('whenScrolled', function() {
    return function(scope, elm, attr) {
        // 内层DIV的滚动加载
        var raw = elm[0];
        elm.bind('scroll', function() {
            if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
                scope.$apply(attr.whenScrolled);
            }
        });
    };
});